<?php
/**
 * Created by PhpStorm.
 * Users: Administrator
 * Date: 2018/9/8
 * Time: 10:05
 */

namespace App\Http;


trait ApiResponse
{
    public function respError($msg='',$errorCode=1)
    {
        return response()->json(['msg'=>$msg,'error_code'=>$errorCode]);
    }

    public function respSuccess($msg='',$data=[],$errorCode=0)
    {
        return response()->json(['msg'=>$msg,'data'=>$data,'error_code'=>$errorCode]);
    }
}